<template>
  <BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="getTitle" @ok="handleSubmit" :width="800">
    <RenderHtml :text="content" />
  </BasicModal>
</template>
<script lang="ts" setup>
  import { ref, computed, unref } from "vue"
  import RenderHtml from "/@/components/My/RenderHtml.vue"
  import { BasicModal, useModalInner } from "/@/components/Modal"

  const emit = defineEmits(["register"])
  const content = ref("")

  const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
    content.value = data.content
    setModalProps({ confirmLoading: false, canFullscreen: false })
  })

  const getTitle = computed(() => "消息内容")
  async function handleSubmit() {
    try {
      setModalProps({ confirmLoading: true })
      closeModal()
    } finally {
      setModalProps({ confirmLoading: false })
    }
  }
</script>
